package com.itchen.hospital.controller;

import com.github.pagehelper.PageInfo;
import com.itchen.hospital.common.Result;
import com.itchen.hospital.pojo.Params;
import com.itchen.hospital.pojo.Patient;
import com.itchen.hospital.pojo.PatientAttendance;
import com.itchen.hospital.service.PatientAttendanceService;
import com.itchen.hospital.service.PatientService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/PatientAttendance")
@Tag(name = "患者就诊接口")
@RequiredArgsConstructor
public class PatientAttendanceController {

    private final PatientAttendanceService patientAttendanceService;

    @GetMapping("/findBySearch")
    @Operation(summary = "条件查询")
    public Result findBySearch(Params params) {
        PageInfo<PatientAttendance> list = patientAttendanceService.search(params);
        return Result.success(list);
    }


    @GetMapping("/update")
    @Operation(summary = "医嘱")
    public Result update(@RequestParam Map<String, Object> map) {
        patientAttendanceService.update(map);
        return Result.success();
    }

    //根据id回显
    @GetMapping("/findById")
    @Operation(summary = "根据id回显")
    public Result findById(Integer id) {
        PatientAttendance patientAttendance = patientAttendanceService.findById(id);
        return Result.success(patientAttendance);
    }
}
